﻿'Proyecto de curso base de datos II
'Universidad Nacional de Ingeniería - Instituto de Estudios Superiories
'Copyright (c) 2008 - Adolfo Fitoria <adolfo.fitoria@gmail.com>
'Bajo licencia GNU Public Licence v.3 

Imports FichasRegistro.Config


Public Class LoginFrom
    Private Sub BtnCancelar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Config.Default.Password = Nothing
        Config.Default.Username = Nothing
        Me.Close()
    End Sub

    Private Sub BtnIniciar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnIniciar.Click
        Dim usuario As New Usuario(Me.txtUsername.Text, Me.txtPassword.Text)
        If usuario.Login = True Then
            Dim mainform As New MainForm(usuario)
            mainform.Show()
            Me.Hide()
            'TODO La cosa fea de cambiar de formularios XD no me acuerdo fuck!
        Else
            MsgBox("Nombre de usuario o Contrasena incorrectas", MsgBoxStyle.Critical, "Error!")
        End If
    End Sub

    Private Sub ConfigureDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ConfigureDB.Click
        Dim formConfig As New dbConfig()
        formConfig.showDialog()
    End Sub

    Private Sub LoginFrom_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.txtUsername.Focus()
    End Sub
End Class
